<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('nodes', function (Blueprint $table) {
            $table->Increments('id')->comment('自增id');
			$table->Integer('pid')->default(0)->unsigned()->comment('父id')->index();
			$table->string('name',32)->comment('节点名称');
			$table->string('ctrl',32)->default("#")->comment('控制器');
			$table->string('action',32)->default("#")->comment('方法名');
			$table->string('router',32)->nullable()->comment('访问地址');
			$table->string('icon',32)->nullable()->comment('图标');
			$table->Integer('sort')->default(0)->unsigned()->comment('排序')->index();
			$table->enum('is_menu',[0=>"否",1=>"是"])->default("是")->comment('是否为菜单项');
			$table->enum('is_resource',[0=>"否",1=>"是"])->default("否")->comment('是否包含资源路由项');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('nodes');
    }
}
